package com.zwt.controller;

import com.zwt.mapper.ArticleMapper;
import com.zwt.pojo.Article;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class MyBatisController {

    @Autowired
    private ArticleMapper articleMapper;

    @GetMapping("/queryArticles")
    public List<Article> queryArticles(){
        List<Article> articleList = articleMapper.queryArticles();
        for(Article article : articleList) {
            System.out.println(article);
        }
        return articleList;
    }
}
